package com.shoesmail.controller;

import com.shoesmail.domain.query.user.UserLoginQuery;
import com.shoesmail.domain.query.user.UserRegisterQuery;
import com.shoesmail.domain.vo.JsonResultVo;
import com.shoesmail.domain.vo.user.UserRegisterVo;
import com.shoesmail.service.UserLoginService;
import jdk.nashorn.internal.objects.annotations.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：CDB
 * @description：用户登陆和注册的Controller
 * @date ：2025/9/17 9:44
 */
@RestController
@RequestMapping("/user")
public class UserLoginController {

    @Autowired
    private UserLoginService userLoginService;

    @GetMapping("/sendEmailCode")
    public JsonResultVo<Boolean> sendEmail(String email){
        return userLoginService.sendEmailCode(email);
    }


    @PostMapping("/register")
    public JsonResultVo<UserRegisterVo> register(UserRegisterQuery userRegisterQuery){
        return userLoginService.register(userRegisterQuery);
    }

    @PostMapping("/login")
    public JsonResultVo<UserRegisterVo> login(UserLoginQuery userLoginQuery){
        return userLoginService.login(userLoginQuery);
    }


}












